This dataset encapsulates a comprehensive collection of financial information, spanning multiple stocks within the Nifty 50 index. It comprises a rich array of data points, including stock prices, trading volumes, and related metrics, amassed over a substantial timeframe. This dataset serves as a valuable resource for analyzing market trends, assessing stock performances, and deriving insights crucial for informed investment strategies and comprehensive market evaluations.
The Nifty 50 index represents a collection of 50 actively traded Indian stocks listed on the National Stock Exchange (NSE). These stocks are chosen based on various factors like market capitalization, liquidity, and other financial parameters. The index serves as a benchmark for the Indian stock market, reflecting the performance of these select companies across diverse sectors, offering a snapshot of the overall market movements.
Regarding the dataset, it encompasses a wide array of financial metrics for stocks within the Nifty 50 index. This includes historical stock prices, trading volumes, market indicators, fundamental ratios, and potentially other relevant data points.
Constraints within this dataset might include factors such as:
import pandas as pd
import glob
import matplotlib.pyplot as plt
import seaborn as sns
file_list = glob.glob('C:/Users/devan/Desktop/Big Data Analytics/Final Project/*.csv')
data_frames = []
for file in file_list:
data = pd.read_csv(file)
data_frames.append(data)
nifty_data = pd.concat(data_frames, ignore_index=True)
This code compiles data from multiple CSV files located in a specified directory. It first collects a list of file paths using 'glob.glob', then reads each CSV file using Pandas' 'read_csv' function and stores the data in a list of data frames. Finally, it merges these separate data frames into a single comprehensive DataFrame named 'nifty_data' using 'pd.concat', providing a consolidated dataset that aggregates information from all the CSV files for streamlined analysis within the context of Big Data Analytics.
nifty_data.head()
| Date | Symbol | Series | Prev Close | Open | High | Low | Last | Close | VWAP | Volume | Turnover | Trades | Deliverable Volume | %Deliverble | Company Name | Industry | ISIN Code | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 2007-11-27 | MUNDRAPORT | EQ | 440.00 | 770.00 | 1050.00 | 770.0 | 959.0 | 962.90 | 984.72 | 27294366.0 | 2.687719e+15 | NaN | 9859619.0 | 0.3612 | NaN | NaN | NaN |
| 1 | 2007-11-28 | MUNDRAPORT | EQ | 962.90 | 984.00 | 990.00 | 874.0 | 885.0 | 893.90 | 941.38 | 4581338.0 | 4.312765e+14 | NaN | 1453278.0 | 0.3172 | NaN | NaN | NaN |
| 2 | 2007-11-29 | MUNDRAPORT | EQ | 893.90 | 909.00 | 914.75 | 841.0 | 887.0 | 884.20 | 888.09 | 5124121.0 | 4.550658e+14 | NaN | 1069678.0 | 0.2088 | NaN | NaN | NaN |
| 3 | 2007-11-30 | MUNDRAPORT | EQ | 884.20 | 890.00 | 958.00 | 890.0 | 929.0 | 921.55 | 929.17 | 4609762.0 | 4.283257e+14 | NaN | 1260913.0 | 0.2735 | NaN | NaN | NaN |
| 4 | 2007-12-03 | MUNDRAPORT | EQ | 921.55 | 939.75 | 995.00 | 922.0 | 980.0 | 969.30 | 965.65 | 2977470.0 | 2.875200e+14 | NaN | 816123.0 | 0.2741 | NaN | NaN | NaN |
nifty_data = nifty_data.astype({'Symbol': 'category'})
nifty_data.info()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 470434 entries, 0 to 470433 Data columns (total 18 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 Date 470384 non-null object 1 Symbol 470434 non-null category 2 Series 470434 non-null object 3 Prev Close 470384 non-null float64 4 Open 470384 non-null float64 5 High 470384 non-null float64 6 Low 470384 non-null float64 7 Last 470384 non-null float64 8 Close 470384 non-null float64 9 VWAP 470384 non-null float64 10 Volume 470384 non-null float64 11 Turnover 470384 non-null float64 12 Trades 240688 non-null float64 13 Deliverable Volume 438230 non-null float64 14 %Deliverble 438230 non-null float64 15 Company Name 50 non-null object 16 Industry 50 non-null object 17 ISIN Code 50 non-null object dtypes: category(1), float64(12), object(5) memory usage: 61.5+ MB
nifty_data.Symbol.unique()
['MUNDRAPORT', 'ADANIPORTS', 'ASIANPAINT', 'UTIBANK', 'AXISBANK', ..., 'VEDL', 'WIPRO', 'ZEETELE', 'ZEEL', 'INFRATEL'] Length: 66 Categories (66, object): ['ADANIPORTS', 'ASIANPAINT', 'AXISBANK', 'BAJAJ-AUTO', ..., 'VEDL', 'WIPRO', 'ZEEL', 'ZEETELE']
Finding unique values (stocks) from the dataset.
nifty_data.shape
(470434, 18)
nifty_data.describe()
| Prev Close | Open | High | Low | Last | Close | VWAP | Volume | Turnover | Trades | Deliverable Volume | %Deliverble | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| count | 470384.000000 | 470384.000000 | 470384.000000 | 470384.000000 | 470384.000000 | 470384.000000 | 470384.000000 | 4.703840e+05 | 4.703840e+05 | 2.406880e+05 | 4.382300e+05 | 438230.000000 |
| mean | 1266.196349 | 1267.759708 | 1286.581440 | 1247.488465 | 1266.388302 | 1266.554351 | 1267.132300 | 3.045903e+06 | 1.610138e+14 | 6.196427e+04 | 1.315098e+06 | 0.502997 |
| std | 2581.367576 | 2585.256861 | 2619.646432 | 2546.618689 | 2581.389799 | 2582.138197 | 2582.697234 | 7.333973e+06 | 3.298082e+14 | 6.866443e+04 | 2.831667e+06 | 0.190019 |
| min | 0.000000 | 8.500000 | 9.750000 | 8.500000 | 9.100000 | 9.150000 | 9.210000 | 3.000000e+00 | 1.047000e+07 | 1.100000e+01 | 5.000000e+00 | 0.023600 |
| 25% | 274.300000 | 275.000000 | 279.500000 | 269.600000 | 274.400000 | 274.350000 | 274.697500 | 2.190095e+05 | 1.612816e+13 | 2.183400e+04 | 1.253825e+05 | 0.364700 |
| 50% | 566.500000 | 567.025000 | 576.900000 | 556.500000 | 567.000000 | 566.700000 | 566.940000 | 1.010938e+06 | 6.832603e+13 | 4.406800e+04 | 5.017560e+05 | 0.511000 |
| 75% | 1242.200000 | 1243.312500 | 1263.000000 | 1221.650000 | 1242.900000 | 1242.400000 | 1242.662500 | 3.019851e+06 | 1.863835e+14 | 7.893550e+04 | 1.452238e+06 | 0.638400 |
| max | 32861.950000 | 33399.950000 | 33480.000000 | 32468.100000 | 32849.000000 | 32861.950000 | 32975.240000 | 4.810589e+08 | 3.564334e+16 | 1.643015e+06 | 2.325307e+08 | 1.000000 |
The descriptive statistics presented here offer insights into various aspects of a financial dataset related to stock market trading. These statistics provide a summary overview of the numerical attributes within the dataset, shedding light on the stock market's price movements and trading volumes.
The 'count' row indicates the total number of observations for each column, implying the quantity of available data points for analysis. The 'mean' row showcases the average values for each attribute, providing a central tendency measure for the dataset. Meanwhile, the 'std' row illustrates the standard deviation, signifying the extent of variability or dispersion around the mean.
The 'min' and 'max' rows signify the minimum and maximum values observed in each column, outlining the range of values present in the dataset. The '25%', '50%', and '75%' rows correspond to the first quartile (25th percentile), median (50th percentile), and third quartile (75th percentile), respectively. These percentiles offer insights into the distribution and spread of the data, indicating the values below which a certain percentage of observations lie.
These descriptive statistics aid in understanding the range, central tendency, and dispersion of stock prices, trading volumes, and related metrics. They facilitate preliminary assessments of data characteristics, aiding analysts and investors in making informed decisions and formulating strategies based on historical market behavior.
nifty_data.isna().sum()
Date 50 Symbol 0 Series 0 Prev Close 50 Open 50 High 50 Low 50 Last 50 Close 50 VWAP 50 Volume 50 Turnover 50 Trades 229746 Deliverable Volume 32204 %Deliverble 32204 Company Name 470384 Industry 470384 ISIN Code 470384 dtype: int64
nifty_data['Date'] = pd.to_datetime(nifty_data['Date'])
nifty_data['Year'] = nifty_data['Date'].dt.year
nifty_data_yearly = nifty_data.groupby('Year')[['High', 'Low']].mean()
plt.figure(figsize=(10, 6))
bar_width = 0.35
index = nifty_data_yearly.index
plt.bar(index - bar_width/2, nifty_data_yearly['High'], bar_width, color='blue', label='High')
plt.bar(index + bar_width/2, nifty_data_yearly['Low'], bar_width, color='red', label='Low')
plt.title('Nifty 50 Index Changes (2000 - 2021)')
plt.xlabel('Year')
plt.ylabel('Average Nifty 50 Index Value')
plt.legend()
plt.xticks(index)
plt.grid(axis='y')
plt.tight_layout()
plt.show()
for stock in nifty_data['Symbol'].unique():
plt.figure(figsize=(8, 5)) # Each stock gets its own plot
temp_df = nifty_data[nifty_data['Symbol'] == stock]
# Group data by year and calculate the mean 'Close' and 'Open' values for each year
yearly_data = temp_df.groupby(temp_df['Date'].dt.year)[['High', 'Low']].mean()
plt.plot(yearly_data.index, yearly_data['High'], marker='o', label='High')
plt.plot(yearly_data.index, yearly_data['Low'], marker='o', label='Low')
plt.title(f"Nifty 50 Index for '{stock}' (Close and Open) by Year")
plt.xlabel('Year')
plt.ylabel('price')
plt.legend()
plt.grid(True)
plt.tight_layout()
plt.show()
This code segment utilizes Python and Matplotlib to generate individual line plots representing the annual mean high and low prices of stocks within the Nifty 50 index. For each unique stock symbol in the dataset, the code creates a distinct plot, adjusting the figure size accordingly.
By isolating the data for each stock symbol, the code groups the information by year, calculating the average high and low prices for every year using the 'groupby' function. The resulting line plots display trends in these yearly average high and low prices, showcasing the fluctuation patterns over time for each stock within the Nifty 50 index.
This visualization strategy facilitates a clear comparison of how high and low prices have trended annually for different stocks. Investors and analysts can interpret these trends to identify historical patterns, assess market volatility, and gain insights into potential price ranges for various stocks over the years, aiding in informed decision-making and strategic analysis within the realm of stock market investments.
nifty_blank = ['JSWSTL','INFRATEL']
nifty_data[nifty_data['Symbol'].isin(nifty_blank)]
| Date | Symbol | Series | Prev Close | Open | High | Low | Last | Close | VWAP | Volume | Turnover | Trades | Deliverable Volume | %Deliverble | Company Name | Industry | ISIN Code | Year | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 127798 | 2005-03-23 | JSWSTL | EQ | 10.00 | 455.00 | 458.50 | 383.60 | 386.9 | 390.15 | 419.86 | 2087710.0 | 8.765375e+13 | NaN | 382057.0 | 0.1830 | NaN | NaN | NaN | 2005.0 |
| 127799 | 2005-03-24 | JSWSTL | EQ | 390.15 | 392.85 | 398.50 | 357.50 | 371.8 | 369.20 | 372.01 | 1226479.0 | 4.562638e+13 | NaN | 232172.0 | 0.1893 | NaN | NaN | NaN | 2005.0 |
| 127800 | 2005-03-28 | JSWSTL | EQ | 369.20 | 376.70 | 394.05 | 375.00 | 380.0 | 378.85 | 383.64 | 1235794.0 | 4.741048e+13 | NaN | 263415.0 | 0.2132 | NaN | NaN | NaN | 2005.0 |
| 127801 | 2005-03-29 | JSWSTL | EQ | 378.85 | 382.90 | 383.80 | 363.25 | 369.1 | 368.05 | 375.26 | 624072.0 | 2.341915e+13 | NaN | 198916.0 | 0.3187 | NaN | NaN | NaN | 2005.0 |
| 127802 | 2005-03-30 | JSWSTL | EQ | 368.05 | 367.00 | 371.90 | 360.05 | 362.7 | 362.15 | 365.13 | 466349.0 | 1.702775e+13 | NaN | 159641.0 | 0.3423 | NaN | NaN | NaN | 2005.0 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 281417 | 2005-09-12 | JSWSTL | EQ | 282.60 | 285.00 | 291.00 | 285.00 | 289.0 | 288.25 | 288.71 | 421914.0 | 1.218089e+13 | NaN | 271520.0 | 0.6435 | NaN | NaN | NaN | 2005.0 |
| 281418 | 2005-09-13 | JSWSTL | EQ | 288.25 | 288.50 | 303.00 | 287.10 | 296.6 | 297.50 | 295.89 | 667860.0 | 1.976153e+13 | NaN | 399014.0 | 0.5975 | NaN | NaN | NaN | 2005.0 |
| 281419 | 2005-09-14 | JSWSTL | EQ | 297.50 | 299.00 | 307.50 | 291.10 | 294.3 | 295.40 | 301.00 | 648158.0 | 1.950985e+13 | NaN | 291204.0 | 0.4493 | NaN | NaN | NaN | 2005.0 |
| 281420 | 2005-09-15 | JSWSTL | EQ | 295.40 | 297.00 | 299.00 | 294.95 | 296.0 | 296.50 | 297.00 | 371305.0 | 1.102761e+13 | NaN | 216658.0 | 0.5835 | NaN | NaN | NaN | 2005.0 |
| 417065 | NaT | INFRATEL | EQ | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | Bharti Infratel Ltd. | TELECOM | INE121J01017 | NaN |
247 rows × 19 columns
symbols_to_drop = ['JSWSTL', 'INFRATEL']
nifty_data_2 = nifty_data[~nifty_data['Symbol'].isin(symbols_to_drop)]
corr = nifty_data_2[nifty_data_2['Symbol']== 'HEROMOTOCO'].corr()
plt.figure(figsize=(10,10))
sns.heatmap(corr, annot=True, cmap="coolwarm")
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\4069535145.py:1: FutureWarning: The default value of numeric_only in DataFrame.corr is deprecated. In a future version, it will default to False. Select only valid columns or specify the value of numeric_only to silence this warning. corr = nifty_data_2[nifty_data_2['Symbol']== 'HEROMOTOCO'].corr()
<Axes: >
corr = nifty_data_2[nifty_data_2['Symbol']== 'HDFC'].corr()
plt.figure(figsize=(10,10))
sns.heatmap(corr, annot=True, cmap="coolwarm")
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\728104081.py:1: FutureWarning: The default value of numeric_only in DataFrame.corr is deprecated. In a future version, it will default to False. Select only valid columns or specify the value of numeric_only to silence this warning. corr = nifty_data_2[nifty_data_2['Symbol']== 'HDFC'].corr()
<Axes: >
corr = nifty_data_2[nifty_data_2['Symbol']== 'HDFCBANK'].corr()
plt.figure(figsize=(10,10))
sns.heatmap(corr, annot=True, cmap="coolwarm")
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\83096412.py:1: FutureWarning: The default value of numeric_only in DataFrame.corr is deprecated. In a future version, it will default to False. Select only valid columns or specify the value of numeric_only to silence this warning. corr = nifty_data_2[nifty_data_2['Symbol']== 'HDFCBANK'].corr()
<Axes: >
corr = nifty_data_2[nifty_data_2['Symbol']== 'HCLTECH'].corr()
plt.figure(figsize=(10,10))
sns.heatmap(corr, annot=True, cmap="coolwarm")
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\251171166.py:1: FutureWarning: The default value of numeric_only in DataFrame.corr is deprecated. In a future version, it will default to False. Select only valid columns or specify the value of numeric_only to silence this warning. corr = nifty_data_2[nifty_data_2['Symbol']== 'HCLTECH'].corr()
<Axes: >
invested_amount_2000 = 500
unique_symbols = nifty_data_2['Symbol'].unique()
results_df = pd.DataFrame(columns=['Symbol', 'First_Open_2000','Invested_amount_2000', 'Last_Close_2021', 'Return_Amount_2021','Net_Worth'])
for symbol in unique_symbols:
symbol_data = nifty_data_2[nifty_data_2['Symbol'] == symbol]
symbol_data = symbol_data.sort_values(by='Year')
first_open_value = symbol_data['Open'].first_valid_index()
first_open = symbol_data.loc[first_open_value, 'Open'] if first_open_value is not None else None
last_close_value = symbol_data['Close'].last_valid_index()
last_close = symbol_data.loc[last_close_value, 'Close'] if last_close_value is not None else None
return_amount_2021 = invested_amount_2000 * last_close / first_open if (first_open is not None and last_close is not None) else None
net = return_amount_2021 - invested_amount_2000
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
results_df
| Symbol | First_Open_2000 | Invested_amount_2000 | Last_Close_2021 | Return_Amount_2021 | Net_Worth | |
|---|---|---|---|---|---|---|
| 0 | MUNDRAPORT | 770.0 | 500 | 135.50 | 87.987013 | -412.012987 |
| 1 | ADANIPORTS | 137.1 | 500 | 730.05 | 2662.472648 | 2162.472648 |
| 2 | ASIANPAINT | 370.0 | 500 | 2536.40 | 3427.567568 | 2927.567568 |
| 3 | UTIBANK | 26.7 | 500 | 597.50 | 11189.138577 | 10689.138577 |
| 4 | AXISBANK | 588.0 | 500 | 714.90 | 607.908163 | 107.908163 |
| ... | ... | ... | ... | ... | ... | ... |
| 59 | SSLT | 185.0 | 500 | 220.15 | 595.000000 | 95.000000 |
| 60 | VEDL | 218.4 | 500 | 257.25 | 588.942308 | 88.942308 |
| 61 | WIPRO | 2724.0 | 500 | 492.75 | 90.446035 | -409.553965 |
| 62 | ZEETELE | 1175.0 | 500 | 238.35 | 101.425532 | -398.574468 |
| 63 | ZEEL | 230.0 | 500 | 185.60 | 403.478261 | -96.521739 |
64 rows × 6 columns
unique_symbols = results_df['Symbol'].unique()
for symbol in unique_symbols:
symbol_data = results_df[results_df['Symbol'] == symbol]
plt.figure(figsize=(6, 4))
plt.bar(['Invested 2000', 'Return 2021'], [symbol_data['Invested_amount_2000'].iloc[0], symbol_data['Return_Amount_2021'].iloc[0]])
plt.xlabel('Amount')
plt.ylabel('Value')
plt.title(f'Invested Amount in 2000 vs Return Amount in 2021 - {symbol}')
plt.tight_layout()
plt.show()
results_df['Price_Difference'] = results_df['Last_Close_2021'] - results_df['First_Open_2000']
max_row = results_df.loc[results_df['Price_Difference'].idxmax()]
print("Stock with maximum growth as on 2021:")
print(max_row)
Stock with maximum growth as on 2021: Symbol SHREECEM First_Open_2000 68.0 Invested_amount_2000 500 Last_Close_2021 27910.5 Return_Amount_2021 205224.264706 Net_Worth 204724.264706 Price_Difference 27842.5 Name: 46, dtype: object
invested_amount_2000 = 1000
unique_symbols = nifty_data_2['Symbol'].unique()
results_df = pd.DataFrame(columns=['Symbol', 'First_Open_2000','Invested_amount_2000', 'Last_Close_2021', 'Return_Amount_2021','Net_Worth'])
for symbol in unique_symbols:
symbol_data = nifty_data_2[nifty_data_2['Symbol'] == symbol]
symbol_data = symbol_data.sort_values(by='Year')
first_open_value = symbol_data['Open'].first_valid_index()
first_open = symbol_data.loc[first_open_value, 'Open'] if first_open_value is not None else None
last_close_value = symbol_data['Close'].last_valid_index()
last_close = symbol_data.loc[last_close_value, 'Close'] if last_close_value is not None else None
return_amount_2021 = invested_amount_2000 * last_close / first_open if (first_open is not None and last_close is not None) else None
net = return_amount_2021 - invested_amount_2000
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
C:\Users\devan\AppData\Local\Temp\ipykernel_16832\2321537900.py:12: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
results_df = results_df.append({'Symbol': symbol, 'First_Open_2000': first_open,'Invested_amount_2000':invested_amount_2000 ,'Last_Close_2021': last_close, 'Return_Amount_2021': return_amount_2021,'Net_Worth':net}, ignore_index=True)
results_df
| Symbol | First_Open_2000 | Invested_amount_2000 | Last_Close_2021 | Return_Amount_2021 | Net_Worth | |
|---|---|---|---|---|---|---|
| 0 | MUNDRAPORT | 770.0 | 1000 | 135.50 | 175.974026 | -824.025974 |
| 1 | ADANIPORTS | 137.1 | 1000 | 730.05 | 5324.945295 | 4324.945295 |
| 2 | ASIANPAINT | 370.0 | 1000 | 2536.40 | 6855.135135 | 5855.135135 |
| 3 | UTIBANK | 26.7 | 1000 | 597.50 | 22378.277154 | 21378.277154 |
| 4 | AXISBANK | 588.0 | 1000 | 714.90 | 1215.816327 | 215.816327 |
| ... | ... | ... | ... | ... | ... | ... |
| 59 | SSLT | 185.0 | 1000 | 220.15 | 1190.000000 | 190.000000 |
| 60 | VEDL | 218.4 | 1000 | 257.25 | 1177.884615 | 177.884615 |
| 61 | WIPRO | 2724.0 | 1000 | 492.75 | 180.892070 | -819.107930 |
| 62 | ZEETELE | 1175.0 | 1000 | 238.35 | 202.851064 | -797.148936 |
| 63 | ZEEL | 230.0 | 1000 | 185.60 | 806.956522 | -193.043478 |
64 rows × 6 columns
plt.figure(figsize=(6, 4))
plt.bar(['Invested 2000', 'Return 2021'], [results_df['Invested_amount_2000'].sum(), results_df['Return_Amount_2021'].sum()])
plt.xlabel('Amount')
plt.ylabel('Value')
plt.title('Invested Amount in 2000 vs Return Amount in 2021')
plt.tight_layout()
plt.show()
results_df['Net_Worth'].sum()-results_df['Invested_amount_2000'].sum()
648661.901070853
percentage_value = round((results_df['Net_Worth'].sum() - results_df['Invested_amount_2000'].sum()) * 100 / results_df['Invested_amount_2000'].sum(), 2)
result_with_percentage = str(percentage_value) + '%'
result_with_percentage
'1013.53%'